<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 500px;
            height: 300px;
            background-color: chartreuse;
            margin: auto;
        }
        
      
    </style>

</head>
<body>
    <div class="box">
        <p>抽奖</p>
        <h1>一等奖:<span class="1">?</span></h1>
        <h2>二等奖:<span class="2">?</span></h2>
        <h3>三等奖:<span class="3">?</span></h3>


    </div>
    <script>
         const  arr1=['张飞','赵云','马超','曹操','貂蝉']
        const arr=['1','2','3',]
        for(let i=0;i<arr.length;i++){
            const g=Math.floor(Math.random()*arr1.length)
            const span=document.querySelectorAll('span')
            span[i].innerHTML=arr1[g]
            arr1.splice(g,1)
        }
        console.log(arr)
       
    </script>
</body>
</html>